<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="{{ asset('admin_style/css/pintuer.css') }}">
   <link rel="stylesheet" href="{{ asset('admin_style/css/admin.css') }}">
    <script src="{{asset('admin_style/js/jquery.js')}}"></script>
    <script src="{{asset('admin_style/js/pintuer.js')}}"></script>
</head>
<style>
    .col{color:red}
</style>
<body>
<div class="panel admin-panel margin-top">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span> 基本信息</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="{{url('/home/chang_update')}}" enctype="multipart/form-data">
        {{ csrf_field() }}
      <div class="form-group">
        <div class="label">
          <label>会员名称：</label>
        </div>
        <div class="field">
	  @if(old('u_name'))
	      <input type="text" class="input" name="u_name" value="{{old('u_name')}}" />
	 @else
	      <input type="text" class="input" name="u_name" value="{{ Session::get('u_name')}}" />
         @endif
            @if($errors->has('u_name'))
                <span class="col">{{$errors->first('u_name')}}</span>
            @endif
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>性别：</label>
        </div>
        <div class="field">
                <div class="product-mulde product-mulde-a">
                  <ul>
                    <li>  
		     @if($data->u_sex== '男')
                      <input type="radio" name="u_sex"  checked  value="男">男
		       <input type="radio" name="u_sex"   value="女">女
		    @elseif($data->u_sex == '女')
                      <input type="radio" name="u_sex"  value="男">男
                      <input type="radio" name="u_sex" checked  value="女">女
		    @else
                      <input type="radio" name="u_sex"  value="男">男
                      <input type="radio" name="u_sex"  value="女">女
		     @endif
                    </li>
                  </ul>
                @if($errors->has('u_sex'))
                    <span class="col">{{$errors->first('u_sex')}}</span>
                @endif
                </div>
              </div>
        </div>
        <div class="form-group">
          <div class="label">
          <label>所在地址：</label>
          </div>
          <div class="field">
	  <select class="input float-left margin-right" style="width: auto;" name='u_r_province'>
		<option value='-1' class='change_city'>请选择省份</option>
		@foreach($linData as $v)
		@if($data->u_r_province == $v->r_city)
		<option value="{{$v->r_id}}" class='change_city' selected >{{$v->r_city}}</option>
		@else
		<option value="{{$v->r_id}}" class='change_city'  >{{$v->r_city}}</option>
		@endif
		 @endforeach
	</select>
	<select class="input float-left margin-right" style="width: auto;" id='select_option' name='u_r_city'>
		@if($data->u_r_city && $u_r_city)
	 	<option value="{{ $u_r_city }}" >{{$data->u_r_city}}</option>
	 	@else<option value='-1'>请选择城市</option>
		@endif
	 </select>
	
          </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label>描述：</label>
            </div>
            <div class="field">
		@if(old('u_desc'))
                <input type="text" name="u_desc" class="input" value="{{ old('u_desc') }}"   placeHolder="随便写点什么，让大家了解你一些" />
		@else
                <input type="text" name="u_desc" class="input" value="{{ $data->u_desc }}"   placeHolder="随便写点什么，让大家了解你一些" />
		@endif
      @if($errors->has('u_desc'))
          <span class="col">{{$errors->first('u_desc')}}</span>
      @endif
            </div>
        </div>
      <div class="form-group">
        <div class="text-center">
         <div class="field">
            <input class="button bg-green" type="submit" value="确定">
            <input type="reset" class="button bg-red" value="重置" />
          </div>
        </div>
      </div>
    </form>
  </div>
</div>
</body>
</html>
<script>
$(".change_city").click(function(){
  var change_id =$(this).attr('value');
   if(change_id == -1){
	 $("#select_option").empty();
	$("#select_option").html("<option>请选择城市</option>");
	return;
   }
   
   $.ajax({
	url:"{{url('home/change_city')}}",
	 type:"get",
	 data:{
                "r_id":change_id,
              },
	 dataType:"json",
	success:function(res){
		if(res['success']){
		  $("#select_option").empty();
		  var str="";
		   for(i=0;i<res['data'].length;i++){
		   str +="<option value ='"+res['data'][i]['r_id']+"'>"+res['data'][i]['r_city']+"</option>";
		  }
		 $("#select_option").html(str);
		}
	}
})
})
</script>
